<?php
/**
 * User: lie
 * Date: 2020/12/7 16:28
 * Title: 判断字符串中是否存在指定子串
 * Description:
 * Error:
 */
$str = "Hello World";
echo $str;
echo '<form action="" method="post">';
    echo '<input type="text" name="txt">';
    echo '<input type="submit" name="sub" value="提交">';
echo '</form>';

if ($_POST['sub']) {
    $txt = $_POST['txt'];
    if (stristr($str, $txt) != "") {
        echo "<script>alert('文本存在子串')</script>";
    } else {
        echo "<script>alert('文本不存在子串')</script>";
    }
}